
package std.sort
import std.collection.*

import std.math.*

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@Frozen
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T>(data: Array<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@Frozen
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T>(data: Array<T>, by!: (T, T) -> Ordering, stable!: Bool = false, descending!: Bool = false): Unit

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T>(data: Array<T>, lessThan!: (T, T) -> Bool, stable!: Bool = false, descending!: Bool = false): Unit

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T, K>(data: Array<T>, key!: (T) -> K, stable!: Bool = false, descending!: Bool = false): Unit where K <: Comparable<K>

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T>(data: List<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T>(data: List<T>, by!: (T, T) -> Ordering, stable!: Bool = false, descending!: Bool = false): Unit

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T>(data: List<T>, lessThan!: (T, T) -> Bool, stable!: Bool = false, descending!: Bool = false): Unit

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T, K>(data: List<T>, key!: (T) -> K, stable!: Bool = false, descending!: Bool = false): Unit where K <: Comparable<K>

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T>(data: ArrayList<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T>(data: ArrayList<T>, by!: (T, T) -> Ordering, stable!: Bool = false, descending!: Bool = false): Unit

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T>(data: ArrayList<T>, lessThan!: (T, T) -> Bool, stable!: Bool = false, descending!: Bool = false): Unit

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sort<T, K>(data: ArrayList<T>, key!: (T) -> K, stable!: Bool = false, descending!: Bool = false): Unit where K <: Comparable<K>

@Deprecated[message: "The interface is deprecated, no substitutions."]
@!APILevel[
    since: "22"
]
public interface SortByExtension<T> {
    @!APILevel[
        since: "22"
    ]
    func sortBy(comparator!: (T, T) -> Ordering): Unit
    
    @!APILevel[
        since: "22"
    ]
    func sortBy(stable!: Bool, comparator!: (T, T) -> Ordering): Unit
}

@Deprecated[message: "The interface is deprecated, no substitutions."]
@!APILevel[
    since: "22"
]
public interface SortExtension {
    @!APILevel[
        since: "22"
    ]
    func sort(): Unit
    
    @!APILevel[
        since: "22"
    ]
    func sort(stable!: Bool): Unit
    
    @!APILevel[
        since: "22"
    ]
    func sortDescending(): Unit
    
    @!APILevel[
        since: "22"
    ]
    func sortDescending(stable!: Bool): Unit
}

extend<T> Array<T> <: SortByExtension<T> {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, by!: (T, T) -> Ordering, stable!: Bool = false, descending!: Bool = false): Unit` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sortBy(comparator!: (T, T) -> Ordering): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, by!: (T, T) -> Ordering, stable!: Bool = false, descending!: Bool = false): Unit` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sortBy(stable!: Bool, comparator!: (T, T) -> Ordering): Unit
}

extend<T> Array<T> <: SortExtension where T <: Comparable<T> {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sort(): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sort(stable!: Bool): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sortDescending(): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sortDescending(stable!: Bool): Unit
}



/**
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
*/
@Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` instead."]
@!APILevel[
    since: "22",
    throwexception: true
]
public func stableSort<T>(data: Array<T>): Unit where T <: Comparable<T>

/**
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
*/
@Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, by!: (T, T) -> Ordering, stable!: Bool = false, descending!: Bool = false): Unit` instead."]
@!APILevel[
    since: "22",
    throwexception: true
]
public func stableSort<T>(data: Array<T>, comparator: (T, T) -> Ordering): Unit



/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` instead."]
@!APILevel[
    since: "22",
    throwexception: true
]
public func unstableSort<T>(data: Array<T>): Unit where T <: Comparable<T>

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@Deprecated[message: "Use global function `public func sort<T>(data: Array<T>, by!: (T, T) -> Ordering, stable!: Bool = false, descending!: Bool = false): Unit` instead."]
@!APILevel[
    since: "22",
    throwexception: true
]
public func unstableSort<T>(data: Array<T>, comparator: (T, T) -> Ordering): Unit



